class Solution {
    public int lengthOfLongestSubstring(String s) {
        char[] ss=s.toCharArray();
        int left=0,right=0,ret=0;
        int[] hash=new int[128];
        while(right<s.length()){
            hash[ss[right]]++;
            while(hash[ss[right]]>1){
                hash[ss[left++]]--;
            }
            ret=Math.max(ret,right-left+1);
            right++;
        }
        return ret;
    }
}